<?php
namespace Admin\Controller;
use Admin\Controller\BaseController;
class ManagerlogController extends BaseController {
    public function index(){
    //管理员登录日志展示信息（显示5条）
        $Mess=M("admin_log");
        $count=$Mess->count(); // 总记录数
        $pages = ceil($count / $this->perpage)+1;
         $nowpage = I("p");
        if(empty($nowpage)){
            $nowpage = 1;
        }
        $Page=new \Think\Page($count,10);
        $Page->setConfig('prev','上一页');
        $Page->setConfig('next','下一页');
        $show= $Page->show();
        $list=$Mess->alias("a")->join("left join __ADMIN_MEMBER__ b on a.admin_id=b.id ")->limit($Page->firstRow.','.$Page->listRows)->order('log_time desc')->select();
        $this->assign("count", $count);
        $this->assign("list", $list);
        $this->assign("page", $show);
        $this->assign("pages", $pages);
        $this->assign("nowpage", $nowpage);
        $id=$_SESSION["pid"];
        $M=M("admin_node");
        $node=$M->where("parent_id='$id'")->select();
        $this->assign("node",$node);
        $this->display();
    }
    //删除日志的方法
    public function delete_log(){
    	$data=I("get.");
    	$id=$data["id"];
    	$M = M("admin_log");
    	$M->where("log_id='$id'")->delete();
        redirect (U("Managerlog/index"),0,"");
    }
}
